package com.wmyg.antifake.gs1.ns2.converters;

import com.wmyg.antifake.gs1.ns2.SpecialString;
import com.wmyg.antifake.gs1.ns2.TSDProductQuantityInformationModule;
import org.dom4j.Element;

import java.util.List;

/**
 * @program: antifake
 * @description: 商品质量信息转换器
 * @author: wong
 * @create: 19-4-23
 */
public class ProductQuantityInformationConverter {

    protected static TSDProductQuantityInformationModule convert(Element element) {
        TSDProductQuantityInformationModule p = new TSDProductQuantityInformationModule();
        List<Element> children = element.elements();
        for (Element e :
                children) {
            if ("netContent".equals(e.getName())) {
                p.setNetContent(new SpecialString(e));
            } else {
                p.setMap(MapConverter.elementToMap(e));
            }
        }
        return p;
    }

}
